package priv.yiyuan.example.design;

/**
 * Linux 文件系统适配器
 *
 * @author YiYuan
 * @data 2025/8/8
 * @apoNote
 */
public class LinuxFileSystemAdapter implements FileSystem {

    private final LinuxNativeFileOperations linuxFileSystem;

    public LinuxFileSystemAdapter(LinuxNativeFileOperations linuxFileSystem) {
        this.linuxFileSystem = linuxFileSystem;
    }

    @Override
    public void createFile(String path) {
        linuxFileSystem.touchFile(path);
    }

    @Override
    public void deleteFile(String path) {
        linuxFileSystem.rmFile(path);
    }

    @Override
    public String readFile(String path) {
        return linuxFileSystem.catFile(path);
    }

    @Override
    public void writeFile(String path, String content) {
        linuxFileSystem.echoToFile(path, content);
    }

    @Override
    public String getFileInfo(String path) {
        return linuxFileSystem.lsFile(path);
    }
}
